<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('收支分类列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="userId"/>
                            </li>
                            <li>
                                <label>类别名称：</label>
                                <input type="text" name="categoryName"/>
                            </li>
                            <li>
                                <label>类别类型：</label>
                                <select name="categoryType" th:with="type=${@dict.getType('fin_category_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:category:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:category:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:category:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:category:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:category:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:category:remove')}]];
        var categoryTypeDatas = [[${@dict.getType('fin_category_type')}]];
        var prefix = ctx + "system/category";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "收支分类",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'categoryId',
                    title: '类别ID',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户ID'
                },
                {
                    field: 'categoryName',
                    title: '类别名称'
                },
                {
                    field: 'categoryType',
                    title: '类别类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(categoryTypeDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.categoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.categoryId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('收支分类列表')" />
    <style>
        :root {
            --primary-color: #5e72e4;  /* 主色调 - 紫色 */
            --secondary-color: #2dce89; /* 辅助色 - 绿色 */
            --accent-color: #f5365c;   /* 强调色 - 红色 */
            --dark-color: #32325d;     /* 深色 */
            --light-color: #f8f9fe;    /* 浅色背景 */
            --text-color: #525f7f;     /* 正文颜色 */
        }

        body {
            font-family: 'Noto Serif SC', serif;
            background-color: var(--light-color);
            color: var(--text-color);
        }

        .container-div {
            padding: 20px;
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
            margin: 15px;
        }

        .search-collapse {
            background-color: white;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }

        .select-list ul {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .select-list li {
            display: flex;
            align-items: center;
            margin-right: 15px;
            margin-bottom: 10px;
        }

        .select-list label {
            margin-right: 8px;
            font-weight: 500;
            color: var(--dark-color);
            white-space: nowrap;
        }

        .select-list input,
        .select-list select {
            border: 1px solid #e9ecef;
            border-radius: 6px;
            padding: 8px 12px;
            height: 38px;
            transition: all 0.3s;
        }

        .select-list input:focus,
        .select-list select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.1);
        }

        .btn {
            border-radius: 6px;
            padding: 8px 15px;
            font-weight: 500;
            transition: all 0.3s;
        }

        .btn-primary {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }

        .btn-primary:hover {
            background-color: #4a5fd1;
            border-color: #4a5fd1;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(94, 114, 228, 0.2);
        }

        .btn-success {
            background-color: var(--secondary-color);
            border-color: var(--secondary-color);
        }

        .btn-success:hover {
            background-color: #26bf7e;
            border-color: #26bf7e;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(45, 206, 137, 0.2);
        }

        .btn-warning {
            background-color: #fb6340;
            border-color: #fb6340;
            color: white;
        }

        .btn-warning:hover {
            background-color: #fa5323;
            border-color: #fa5323;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(251, 99, 64, 0.2);
        }

        .btn-danger {
            background-color: var(--accent-color);
            border-color: var(--accent-color);
        }

        .btn-danger:hover {
            background-color: #e3355d;
            border-color: #e3355d;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(245, 54, 92, 0.2);
        }

        #bootstrap-table {
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }

        .table-striped tbody tr:nth-of-type(odd) {
            background-color: rgba(248, 249, 254, 0.5);
        }

        .table-striped tbody tr:hover {
            background-color: rgba(94, 114, 228, 0.05);
        }

        .fixed-table-toolbar .bs-bars {
            margin-bottom: 15px;
        }

        .btn-xs {
            padding: 4px 8px;
            font-size: 12px;
            border-radius: 4px;
        }

        @media (max-width: 768px) {
            .select-list li {
                width: 100%;
                margin-right: 0;
            }

            .select-list input,
            .select-list select {
                width: 100%;
            }
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>用户ID：</label>
                            <input type="text" name="userId" class="form-control" placeholder="请输入用户ID"/>
                        </li>
                        <li>
                            <label>类别名称：</label>
                            <input type="text" name="categoryName" class="form-control" placeholder="请输入类别名称"/>
                        </li>
                        <li>
                            <label>类别类型：</label>
                            <select name="categoryType" class="form-control" th:with="type=${@dict.getType('fin_category_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:category:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:category:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:category:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:category:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:category:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:category:remove')}]];
    var categoryTypeDatas = [[${@dict.getType('fin_category_type')}]];
    var prefix = ctx + "system/category";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "收支分类",
            columns: [{
                checkbox: true
            },
            {
                field: 'categoryId',
                title: '类别ID',
                visible: false
            },
            {
                field: 'userId',
                title: '用户ID'
            },
            {
                field: 'categoryName',
                title: '类别名称'
            },
            {
                field: 'categoryType',
                title: '类别类型',
                formatter: function(value, row, index) {
                   return $.table.selectDictLabel(categoryTypeDatas, value);
                }
            },
            {
                title: '操作',
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.categoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.categoryId + '\')"><i class="fa fa-remove"></i>删除</a>');
                    return actions.join('');
                }
            }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>